<?php

$today = last_working_day(strftime('%Y-%m-%d', time()));
$lastday = last_working_day($today);

$date_param = get_param_value('date_param', 'pnl_date_param', $lastday);
$_SESSION['pnl_date_param'] = $date_param;

$date_param2 = get_param_value('date_param2', 'pnl_date_param2', $today);
$_SESSION['pnl_date_param2'] = $date_param2;

$fund_param = get_param_value('fund_param', 'pnl_fund_param', 'SC001');
$_SESSION['pnl_fund_param'] = $fund_param;

//print_r($fund_param);
//print_r($date_param);
//print_r($date_param2);

$action_url = elgg_get_site_url().'portfolio/pnl';
echo "<form method='get' action='$action_url'>";
echo '<p><label>Start Date:</label><br/>'; 
echo elgg_view('input/datepicker', array(
	'name' => 'date_param',
	'value' => $date_param,
	'style' => 'width:100px',
));
echo '</p><p><label>End Date:</label><br/>'; 
echo elgg_view('input/datepicker', array(
	'name' => 'date_param2',
	'value' => $date_param2,
	'style' => 'width:100px',
));
echo '</p><p><label>Fund:</label><br/>'; 
echo elgg_view('input/dropdown', array(
	'name' => 'fund_param',
	'value' => $fund_param,
	'options_values' => get_fund_array(false),
));
echo '</p>'; 

echo elgg_view('input/submit', array(
	'name' => 'search',
	'value' => 'Search',
));

///daniel.lin 2012-8-21
/// for export to excel
echo '<br/><br/>'.elgg_view('input/submit', array(
		'name' => 'export',
		'value' => 'Export to Excel',
));

echo "</form>";

